# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=dillo
pkgver=3.1.0
pkgrel=0
pkgdesc="Very small and fast GUI web browser"
url="https://github.com/w00fpack/dilloNG"
arch="all"
license="GPL-3.0-or-later"
depends="ca-certificates wget"
makedepends="
	autoconf
	automake
	fltk-dev
	libjpeg-turbo-dev
	libpng-dev
	libx11-dev
	mbedtls-dev
	zlib-dev
	"
subpackages="$pkgname-doc"
source="https://github.com/w00fpack/dilloNG/archive/refs/tags/Dillo${pkgver%.*}X/dillo-$pkgver.tar.gz
	dillo.desktop
	gcc-10.patch
	"
builddir="$srcdir/dilloNG-Dillo${pkgver%.*}X"

prepare() {
	default_prepare

	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-png \
		--enable-gif \
		--enable-jpeg \
		--enable-ipv6 \
		--enable-ssl \
		--with-ca-certs-dir=/etc/ssl/certs

	make
}

check() {
	./src/dillo --version
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 AUTHORS ChangeLog README NEWS \
		-t "$pkgdir"/usr/share/doc/$pkgname/

	install -Dm644 "$srcdir"/dillo.desktop \
		-t "$pkgdir"/usr/share/applications/
}

doc() {
	default_doc

	install -dv "$pkgdir"/usr/share/doc/$pkgname
	mv -vt "$pkgdir"/usr/share/doc/$pkgname/ \
		"$subpkgdir"/usr/share/doc/$pkgname/db?.png \
		"$subpkgdir"/usr/share/doc/$pkgname/speeddial*
}

sha512sums="
68a69f4fe4152bd8673ff6accfda741fa6391b188580df08513d1cf1d915a74f635de1ecdebefd0c3e6ab908150c1189114ca57dfad1f7826d1405f46bea21e4  dillo-3.1.0.tar.gz
393a749d33f78e4c8a99c0c94a9708b26d235356f0c8dfa942af4e8da7eb9aa2453911894461714986449dfd15a4b492ef9071fac6b230f52a8f2e562f1bf016  dillo.desktop
7cb0e73fd26028ad85edbf2c9ca86dd47728b6447ef10ede293fc0de11497f900d0a1f9ee90d4bf1a2e9137a4cebe96a491f3024bdb281ec7f7b68ea7a200ad6  gcc-10.patch
"
